<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a="https://ajax4jsf.dev.java.net/ajax"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:j4j="http://javascript4jsf.dev.java.net/"
	template="../include/template.xhtml">
	
	<ui:define name="pageTitle">
		<h:outputText value="项目添加" />
	</ui:define>
	<ui:define name="logoTitle">
		<h:outputText value="项目" />
	</ui:define>
	

	<ui:define name="content">
		<style type="text/css">
<!--
.inputClass {
	border: 1px solid #6699CC;
	width: 300px;
	margin-left: 4px;
}

.stringBlue {
	font-size: 16px;
	font-weight: bold;
	color: #3599fc;
}
-->
</style>

		<script src="../js/add.js"></script>
		<rich:tabPanel switchType="ajax"
			binding="#{taskAddAction.htmlTabPanel}" styleClass="right_center">
			<rich:tab label="第一步：填写基本信息" binding="#{taskAddAction.htmlTabFirst}">
				<h:form id="taskForm">
					<s:validateAll>
						<s:decorate id="nameDecorate"
							template="../include/task/inputField.xhtml">
							<ui:define name="label">项目名称</ui:define>
							<h:inputText value="#{innerTask.name}" class="inputClass"
								required="true">
								<a:support event="onblur" reRender="nameDecorate" />
							</h:inputText>
							<ui:define name="remark">建议填入简洁易懂的标题</ui:define>
						</s:decorate>
						<s:decorate template="../include/task/inputField.xhtml"
							id="tagDecorate">
							<ui:define name="label">项目标签</ui:define>
							<h:inputTextarea value="#{innerTask.tag}" class="inputClass" rows="1"
								onclick="showCatetoryDiv();">
							</h:inputTextarea>
							<ui:define name="remark">标签是为了让投标者更方便的找到此项目[可选择]</ui:define>
						</s:decorate>
						<s:div id="categoryDiv" style="display:none;">
							<rich:dataGrid value="#{categoryAction.getCategoriesByLevel(1)}"
								var="category" columns="3" elements="9">
								<rich:panel style="width:200px">
									<f:facet name="header">
										<h:outputText value="#{category.name}"></h:outputText>
									</f:facet>
									<h:panelGrid columns="2">
										<a:repeat value="#{category.children}" var="child">
											<a:commandLink
												action="#{taskAddAction.addCategoriesToTag(child)}"
												value="#{child.name}," reRender="tagDecorate" />
										</a:repeat>
									</h:panelGrid>
								</rich:panel>
							</rich:dataGrid>
						</s:div>
						<s:decorate template="../include/task/inputField.xhtml">
							<ui:define name="label">项目描述</ui:define>
							<h:inputTextarea value="#{innerTask.description}" class="inputClass"
								style="width:600px;" rows="7" onclick="hideCategoryDiv();"></h:inputTextarea>
						</s:decorate>

						<h:panelGroup id="panel">
							<s:decorate template="../include/task/inputField.xhtml">
								<ui:define name="label">项目预算</ui:define>
								<h:inputText id="budget" onblur="returnBudgetValue();"
									value="#{innerTask.budget}" class="inputClass" required="true"></h:inputText>
								<h:outputText value="元(RMB)" />
							</s:decorate>
						</h:panelGroup>
						<s:decorate template="../include/task/inputField.xhtml">
							<ui:define name="label">投标时间</ui:define>
							<h:selectOneMenu value="#{innerTask.bidDay}" class="inputClass">
								<f:selectItems value="#{taskAddAction.daysItems}" />
							</h:selectOneMenu>
						</s:decorate>

						<s:decorate id="attachDecorate">
							<rich:fileUpload
								fileUploadListener="#{taskAddAction.uploadListener}"
								immediateUpload="true" styleClass="inputClass"
								maxFilesQuantity="5" autoclear="false" addControlLabel="添加附件"
								uploadControlLabel="上传" clearAllControlLabel="清除所有"
								clearControlLabel="清除" cancelEntryControlLabel="取消"
								stopControlLabel="停止" stopEntryControlLabel="停止"
								noDuplicate="true" listHeight="50" listWidth="600"
								style="height:100;" id="upload" acceptedTypes="doc,ppt,txt">
							</rich:fileUpload>
							<ui:define name="remark">单个附件容量最大不超过2M</ui:define>
						</s:decorate>
						<h:commandButton value="下一步" action="#{taskAddAction.firstNext}"
							class="gbutton"></h:commandButton>
					</s:validateAll>
				</h:form>
			</rich:tab>
			<rich:tab label="第二步：填写会员信息" disabled="true"
				binding="#{taskAddAction.htmlTabSecond}">

				<s:div rendered="#{loginUser==null}">
					<br />
					<h:outputText value="您需要是会员才能继续进行操作" class="redAlert"></h:outputText>
					<ui:include src="../include/registerForm.xhtml" />
				</s:div>

				<h:form rendered="#{loginUser!=null}">
					<h:outputText value="填写联系信息"></h:outputText>
					<s:decorate template="../include/task/inputField.xhtml">
						<ui:define name="label">联系人</ui:define>
						<h:inputText value="#{innerTask.owner.trueName}" class="inputClass"></h:inputText>
					</s:decorate>
					<s:decorate template="../include/task/inputField.xhtml">
						<ui:define name="label">联系电话</ui:define>
						<h:inputText value="#{innerTask.owner.telephone}" class="inputClass"></h:inputText>
					</s:decorate>
					<s:decorate template="../include/task/inputField.xhtml">
						<ui:define name="label">Email</ui:define>
						<h:inputText value="#{innerTask.owner.email}" class="inputClass"></h:inputText>
					</s:decorate>
					<h:commandButton action="#{taskAddAction.secondNext}" value="下一步"
						class="gbutton"></h:commandButton>
				</h:form>
			</rich:tab>
			<rich:tab label="第三步：确认提交" binding="#{taskAddAction.htmlTabThird}"
				disabled="true">
				<h:form>
					<s:div>
						<h:panelGrid columns="1">
							<s:formattedText value="#{innerTask.name}" />
							<s:formattedText value="#{innerTask.description}" />
							<a:commandButton action="#{taskAddAction.add()}" value="发布"
								styleClass="gbutton"></a:commandButton>
						</h:panelGrid>
					</s:div>
				</h:form>
			</rich:tab>
		</rich:tabPanel>
	</ui:define>
</ui:composition>
